package com.transport.analysis.traffic;

import org.apache.hadoop.io.Writable;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class TrafficMetricWritable implements Writable {
    private int passengersOn;
    private int passengersOff;
    private int crowdLevel;

    public TrafficMetricWritable() {
    }

    public TrafficMetricWritable(int passengersOn, int passengersOff, int crowdLevel) {
        this.passengersOn = passengersOn;
        this.passengersOff = passengersOff;
        this.crowdLevel = crowdLevel;
    }

    public int getPassengersOn() {
        return passengersOn;
    }

    public void setPassengersOn(int passengersOn) {
        this.passengersOn = passengersOn;
    }

    public int getPassengersOff() {
        return passengersOff;
    }

    public void setPassengersOff(int passengersOff) {
        this.passengersOff = passengersOff;
    }

    public int getCrowdLevel() {
        return crowdLevel;
    }

    public void setCrowdLevel(int crowdLevel) {
        this.crowdLevel = crowdLevel;
    }

    @Override
    public void write(DataOutput out) throws IOException {
        out.writeInt(passengersOn);
        out.writeInt(passengersOff);
        out.writeInt(crowdLevel);
    }

    @Override
    public void readFields(DataInput in) throws IOException {
        passengersOn = in.readInt();
        passengersOff = in.readInt();
        crowdLevel = in.readInt();
    }

    @Override
    public String toString() {
        return passengersOn + "\t" + passengersOff + "\t" + crowdLevel;
    }
}